package com.cf.studiomanage.service.impl;

import com.cf.studiomanage.entity.Message;
import com.cf.studiomanage.mapper.MessageMapper;
import com.cf.studiomanage.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageServiceImpl implements MessageService {

    @Autowired
    private MessageMapper mapper;

    @Override
    public boolean send(Message message) {
        return mapper.send(message) > 0;
    }

    @Override
    public List<Message> getUserMessages(Long userId) {
        return mapper.getByUser(userId);
    }

    @Override
    public boolean markAsRead(Long id) {
        return mapper.markAsRead(id) > 0;
    }
}
